<?php
session_start();
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/database.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/functions.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/class.admin.php');
$admin = new admin();
$admin->canView($_SERVER['PHP_SELF']);
$name=$admin->clean($_POST['group_name']);
$data=new database();
$data->db(DATABASE)->collection('groups');
$data->criteria(array('name'=>$name));
$data->insert();
?>
<script>
$("#groups-click").click();
</script>